import { Redirect, Route } from 'react-router-dom';
import { IonApp, IonRouterOutlet } from '@ionic/react';
import { IonReactRouter } from '@ionic/react-router';
// ARR
import RouterArr from "./arrary";

function RouterObj(){
    return (
    <IonReactRouter>
      <IonRouterOutlet>
          {
             RouterArr.map((item,index)=>{
                 return (
                    <Route
                    key={index}
                    exact={item.exact}
                    path={item.path}
                    render={
                      props => <item.component {...props} />
                    }
                    >
                  </Route>
                 )
             }) 
          }
      </IonRouterOutlet>
    </IonReactRouter>
    )
}
/****
 * 
 * 
 * <Route exact path="/home">
          <Home />
        </Route>
        <Route exact path="/">
          <Redirect to="/Article/detail" />
        </Route>
        <Route
        exact 
        path="/Article/detail"
        >
          <ArticlDetail />

        </Route>
 * 
 * 
 * 
 */

export default RouterObj;